package com.chixing.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class ReadConnProperties {
    private static Properties properties = new Properties();
    static{
        // 加载文件到读取流中
        InputStream inputStream = ReadConnProperties.class.getResourceAsStream("/com/chixing/config/dbconn.properties");
        try {
            properties.load(inputStream);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

// 如何读取properties文件中的数据
    public static String getDriverName(){
        return properties.getProperty("drivername");
    }
    public static String getUrl(){
        return properties.getProperty("url");
    }
    public static String getUsername(){
        return properties.getProperty("username");
    }
    public static String getPassword(){
        return properties.getProperty("password");
    }
}
